package com.neu.wms.service.impl;

import com.neu.wms.dto.CustomerDto;
import com.neu.wms.entity.WmsCustomer;
import com.neu.wms.mapper.WmsCustomerMapper;
import com.neu.wms.service.CustomerService;
import com.neu.wms.vo.CustomerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CustomerServiceImpl implements CustomerService{
    @Autowired
    WmsCustomerMapper wmsCustomerMapper;

    @Override
    public List<CustomerVo> selectAll(CustomerDto customerDto) {
        return wmsCustomerMapper.selectAll(customerDto);
    }

    @Override
    public int insert(WmsCustomer customer) {
        customer.setDelFlag(0);
        return wmsCustomerMapper.insertSelective(customer);
    }

    @Override
    public int update(WmsCustomer wmsCustomer) {
        return wmsCustomerMapper.updateByPrimaryKeySelective(wmsCustomer);
    }

    @Override
    public int delete(Long id) {
        return wmsCustomerMapper.deleteByPrimaryKey(id);
    }

    @Override
    public WmsCustomer selectByPrimaryKey(Long id) {
        return wmsCustomerMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateDelFlag(CustomerDto customerDto) {
        return wmsCustomerMapper.updateDelFlag(customerDto);
    }
}
